package mr.ali.webvideo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import mr.ali.webvideo.model.CollectionUserMonyIncome;
import mr.ali.webvideo.mapper.CollectionUserMonyIncomeMapper;
import mr.ali.webvideo.service.ICollectionUserMonyIncomeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Mr-ali
 * @since 2025-08-16
 */
@Service
public class CollectionUserMonyIncomeServiceImpl extends ServiceImpl<CollectionUserMonyIncomeMapper, CollectionUserMonyIncome> implements ICollectionUserMonyIncomeService {
    @Resource
    private CollectionUserMonyIncomeMapper collectionUserMonyIncomeMapper;

    @Override
    public List<CollectionUserMonyIncome> getCollectionUserMonyList(Integer userId) {
        QueryWrapper<CollectionUserMonyIncome> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id", userId);
        queryWrapper.orderByDesc("gmt_create");
        return collectionUserMonyIncomeMapper.selectList(queryWrapper);
    };


    @Override
    public void insertCollectionUserMonyIncome(CollectionUserMonyIncome collectionUserMonyIncome) {
        collectionUserMonyIncomeMapper.insert(collectionUserMonyIncome);
    }
}
